#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<assert.h>

char* my_strncpy(char* dest, const char* src, size_t num)
{
    assert(dest && src);
    const char* ret = dest;
    while (num--)
    {
        *dest = *src;
        dest++;
        src++;
    }
    return ret;
}

int main()
{
    char arr1[] = "hello world";
    char arr2[20] = { 0 };
    my_strncpy(arr2, arr1, 5);
    printf("%s\n", arr2);

    return 0;
}